import request from '@u/request'
import { HttpMethod } from '@u/http'


// 查询菜单列表
export function listMenu (query) {
  return request({
    url: '/sys/menu/list',
    method: HttpMethod.GET,
    params: query
  })
}

// 查询菜单详细
export function getMenu (menuId) {
  return request({
    url: '/sys/menu/' + menuId,
    method: HttpMethod.GET
  })
}

// 查询菜单下拉树结构
export function getTreeSelect () {
  return request({
    url: '/sys/menu/getTreeSelect',
    method: HttpMethod.GET
  })
}

// 根据角色ID查询菜单下拉树结构
export function getRoleMenuTreeSelect (roleId) {
  return request({
    url: '/sys/menu/getRoleMenuTreeSelect/' + roleId,
    method: HttpMethod.GET
  })
}

// 新增菜单
export function addMenu (data) {
  return request({
    url: '/sys/menu',
    method: HttpMethod.POST,
    data: data
  })
}

// 修改菜单
export function updateMenu (data) {
  return request({
    url: '/sys/menu',
    method: HttpMethod.PUT,
    data: data
  })
}

// 删除菜单
export function delMenu (menuId) {
  return request({
    url: '/sys/menu/' + menuId,
    method: HttpMethod.DELETE
  })
}
